Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • KoosMos 19 posts 41 karma points
    Jul 10, 2012 @ 17:06
    KoosMos
    0

    Release date return {01/01/0001 00:00:00}

    Hi,

    I use umbraco 4.7.2 and I try to get the release date with this code :

    new Document(id).ReleaseDate

    But it always return {01/01/0001 00:00:00}.

    Have you a solution please ??

    Thank you

     

     

     

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 10, 2012 @ 17:32
    Morten Bock
    0

    The ReleaseDate property is a DateTime, which is not nullable.

    When the document does not have a ReleaseDate, then it will return the default value of a DateTime object. The default is DateTime.MinValue, which is what you are seeing above.

    So the "solution" depends on what you are looking to do. You could make your logic to check if the ReleaseDate is DateTime.MinValue, and then ignore it.

  • KoosMos 19 posts 41 karma points
    Jul 10, 2012 @ 17:47
    KoosMos
    0

    Hi, thank you for your response.

    But in my case, I have set a publish date and my code returns {01/01/0001 00:00:00}. instead of  {11/07/2012 01:00:00}.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 10, 2012 @ 19:25
    Morten Bock
    0

    I just took a quick look at the source, and I can't see how that would happen.

    Could you double check that you are getting the correct document, and the other properties are populated correctly?

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 10, 2012 @ 20:28
    Fuji Kusaka
    0

    Hi Koomos,

    Have you considered using ucomponents ? I had the same issue a few months back and used Ucomponents which has some nice featues like GetReleaseDate and GetExpireDate.

    Anyways here is how i solved it

    //fuji

  • KoosMos 19 posts 41 karma points
    Jul 11, 2012 @ 11:22
    KoosMos
    1

    I use Ucomponents and it works fine, with this code :

    uComponents.Core.uQuery.GetDocument(id).ReleaseDate

    Thank you

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 11, 2012 @ 14:04
    Morten Bock
    0

    Hmm, I'll have to take a look at what the difference is. Sounds like a bug, so should be reported so it can be fixed in the core.

Please Sign in or register to post replies

Write your reply to:

Draft